﻿<!--
Copyright © 2010 François Karman

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
OTHER DEALINGS IN THE SOFTWARE.

See <license.txt> for the complete license of the software.
-->
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                    xmlns:local="clr-namespace:Faz.Dependencies.Controls">

    <Style x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type local:DependencyView}, ResourceId=ItemContainerDefaultStyleKey}"
           TargetType="{x:Type ListViewItem}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListViewItem}">
                    <Border AllowDrop="{TemplateBinding AllowDrop}"
                            Background="{TemplateBinding Background}"
                            BindingGroup="{TemplateBinding BindingGroup}"
                            BitmapEffect="{TemplateBinding BitmapEffect}"
                            BitmapEffectInput="{TemplateBinding BitmapEffectInput}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            CacheMode="{TemplateBinding CacheMode}"
                            Clip="{TemplateBinding Clip}"
                            ClipToBounds="{TemplateBinding ClipToBounds}"
                            ContextMenu="{TemplateBinding ContextMenu}"
                            Cursor="{TemplateBinding Cursor}"
                            Effect="{TemplateBinding Effect}"
                            FlowDirection="{TemplateBinding FlowDirection}"
                            Focusable="{TemplateBinding Focusable}"
                            FocusVisualStyle="{TemplateBinding FocusVisualStyle}"
                            ForceCursor="{TemplateBinding ForceCursor}"
                            Height="{TemplateBinding Height}"
                            HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                            LayoutTransform="{TemplateBinding LayoutTransform}"
                            Margin="{TemplateBinding Margin}"
                            MaxHeight="{TemplateBinding MaxHeight}"
                            MaxWidth="{TemplateBinding MaxWidth}"
                            MinHeight="{TemplateBinding MinHeight}"
                            MinWidth="{TemplateBinding MinWidth}"
                            Opacity="{TemplateBinding Opacity}"
                            OpacityMask="{TemplateBinding OpacityMask}"
                            Padding="{TemplateBinding Padding}"
                            RenderTransform="{TemplateBinding RenderTransform}"
                            RenderTransformOrigin="{TemplateBinding RenderTransformOrigin}"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                            ToolTip="{TemplateBinding ToolTip}"
                            UseLayoutRounding="{TemplateBinding UseLayoutRounding}"
                            VerticalAlignment="{TemplateBinding VerticalAlignment}"
                            Visibility="{TemplateBinding Visibility}"
                            Width="{TemplateBinding Width}">
                        <ContentPresenter ContentSource="Content"
                                          HorizontalAlignment="Stretch"
                                          VerticalAlignment="Stretch" />
                    </Border>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Style.Triggers>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsSelected"
                               Value="True" />
                    <Condition Property="IsFocused"
                               Value="True" />
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter Property="Background"
                            Value="{x:Static Member=SystemColors.HighlightBrush}" />
                    <Setter Property="Foreground"
                            Value="{x:Static Member=SystemColors.HighlightTextBrush}" />
                </MultiTrigger.Setters>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsSelected"
                               Value="True" />
                    <Condition Property="IsFocused"
                               Value="False" />
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter Property="Background"
                            Value="{x:Static Member=SystemColors.ControlBrush}" />
                </MultiTrigger.Setters>
            </MultiTrigger>
            <MultiTrigger>
                <MultiTrigger.Conditions>
                    <Condition Property="IsSelected"
                               Value="False" />
                    <Condition Property="IsFocused"
                               Value="False" />
                </MultiTrigger.Conditions>
                <MultiTrigger.Setters>
                    <Setter Property="Background"
                            Value="White" />
                </MultiTrigger.Setters>
            </MultiTrigger>
        </Style.Triggers>
    </Style>

    <Style x:Key="{ComponentResourceKey TypeInTargetAssembly={x:Type local:DependencyView}, ResourceId=DefaultStyleKey}"
           TargetType="{x:Type ListView}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type ListView}">
                    <Grid>
                        <Grid.RowDefinitions>
                            <RowDefinition Height="Auto" />
                            <RowDefinition Height="*" />
                        </Grid.RowDefinitions>
                        <Grid.ColumnDefinitions>
                            <ColumnDefinition Width="Auto" />
                            <ColumnDefinition Width="*" />
                        </Grid.ColumnDefinitions>
                        <ContentControl Grid.Row="0"
                                        Grid.Column="0"
                                        Content="{Binding Path=View.Corner, RelativeSource={RelativeSource Mode=TemplatedParent}}" />
                        <local:DependencyViewReference Grid.Row="0"
                                                       Grid.Column="1" />
                        <ItemsPresenter Grid.Row="1"
                                        Grid.Column="0" />
                        <local:DependencyViewResult Grid.Row="1"
                                                    Grid.Column="1" />
                    </Grid>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <UniformGrid Columns="1"
                                 IsItemsHost="True" />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type local:DependencyViewReference}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:DependencyViewReference}">
                    <ItemsPresenter />
                </ControlTemplate>
            </Setter.Value>
        </Setter>
        <Setter Property="ItemsPanel">
            <Setter.Value>
                <ItemsPanelTemplate>
                    <UniformGrid Rows="1"
                                 IsItemsHost="True" />
                </ItemsPanelTemplate>
            </Setter.Value>
        </Setter>
    </Style>

    <Style TargetType="{x:Type local:DependencyViewResultItem}">
        <Setter Property="Template">
            <Setter.Value>
                <ControlTemplate TargetType="{x:Type local:DependencyViewResultItem}">
                    <Border AllowDrop="{TemplateBinding AllowDrop}"
                            Background="{TemplateBinding Background}"
                            BindingGroup="{TemplateBinding BindingGroup}"
                            BitmapEffect="{TemplateBinding BitmapEffect}"
                            BitmapEffectInput="{TemplateBinding BitmapEffectInput}"
                            BorderBrush="{TemplateBinding BorderBrush}"
                            BorderThickness="{TemplateBinding BorderThickness}"
                            CacheMode="{TemplateBinding CacheMode}"
                            Clip="{TemplateBinding Clip}"
                            ClipToBounds="{TemplateBinding ClipToBounds}"
                            ContextMenu="{TemplateBinding ContextMenu}"
                            Cursor="{TemplateBinding Cursor}"
                            Effect="{TemplateBinding Effect}"
                            FlowDirection="{TemplateBinding FlowDirection}"
                            Focusable="{TemplateBinding Focusable}"
                            FocusVisualStyle="{TemplateBinding FocusVisualStyle}"
                            ForceCursor="{TemplateBinding ForceCursor}"
                            Height="{TemplateBinding Height}"
                            HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
                            LayoutTransform="{TemplateBinding LayoutTransform}"
                            Margin="{TemplateBinding Margin}"
                            MaxHeight="{TemplateBinding MaxHeight}"
                            MaxWidth="{TemplateBinding MaxWidth}"
                            MinHeight="{TemplateBinding MinHeight}"
                            MinWidth="{TemplateBinding MinWidth}"
                            Opacity="{TemplateBinding Opacity}"
                            OpacityMask="{TemplateBinding OpacityMask}"
                            Padding="{TemplateBinding Padding}"
                            RenderTransform="{TemplateBinding RenderTransform}"
                            RenderTransformOrigin="{TemplateBinding RenderTransformOrigin}"
                            SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"
                            ToolTip="{TemplateBinding ToolTip}"
                            UseLayoutRounding="{TemplateBinding UseLayoutRounding}"
                            VerticalAlignment="{TemplateBinding VerticalAlignment}"
                            Visibility="{TemplateBinding Visibility}"
                            Width="{TemplateBinding Width}">
                        <ContentPresenter ContentSource="Content" />
                    </Border>
                    <ControlTemplate.Triggers>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsVerticallySelected"
                                           Value="True" />
                                <Condition Property="IsHorizontallySelected"
                                           Value="False" />
                            </MultiTrigger.Conditions>
                            <Setter Property="Background"
                                    Value="{x:Static Member=SystemColors.ControlBrush}" />
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsVerticallySelected"
                                           Value="False" />
                                <Condition Property="IsHorizontallySelected"
                                           Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter Property="Background"
                                    Value="{x:Static Member=SystemColors.ControlBrush}" />
                        </MultiTrigger>
                        <MultiTrigger>
                            <MultiTrigger.Conditions>
                                <Condition Property="IsVerticallySelected"
                                           Value="True" />
                                <Condition Property="IsHorizontallySelected"
                                           Value="True" />
                            </MultiTrigger.Conditions>
                            <Setter Property="Background"
                                    Value="{x:Static Member=SystemColors.ControlLightBrush}" />
                        </MultiTrigger>
                    </ControlTemplate.Triggers>
                </ControlTemplate>
            </Setter.Value>
        </Setter>
    </Style>
</ResourceDictionary>
